from django.db import models

# Create your models here.

"""用户表"""
class User(models.Model):
    username = models.CharField(max_length=30,verbose_name="用户名")
    password = models.CharField(max_length=526,verbose_name="密码")
    mobile = models.CharField(max_length=11,verbose_name="手机号")
    tx = models.CharField(max_length=326,verbose_name="头像路由")
    qm = models.CharField(max_length=326,verbose_name="个人签名",default=None)
    blance = models.IntegerField(verbose_name="余额")
    class Meta:
        db_table = "tb_user"
        verbose_name = '用户表'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.username


"""充值表"""
class Cz(models.Model):
    dd = models.IntegerField(verbose_name="充值豆豆")
    price = models.IntegerField(verbose_name="价格")

    class Meta:
        db_table = "tb_cz"
        verbose_name = '充值表'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.dd


"""用户充值表"""
class Usercz(models.Model):
    user_id = models.ForeignKey(User,on_delete=models.CASCADE,verbose_name="所属用户")
    cz_id = models.ForeignKey(Cz,on_delete=models.CASCADE,verbose_name="充值")
    class Meta:
        db_table = "tb_user_cz"
        verbose_name = '用户充值表'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.id


